import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './store'
import './assets/less/app.less'
import MuseUI from 'muse-ui';
import 'muse-ui/dist/muse-ui.css';
Vue.use(MuseUI);
import Mint from 'mint-ui';
import "mint-ui/lib/style.css"
Vue.use(Mint);
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
import './assets/css/public.css'
Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
	if (to.meta.requireAuth) {  // 判断该路由是否需要登录权限
        // if (store.state.token) {  // 通过vuex state获取当前的token是否存在
        //     next();
        // }else {
        //     next({
        //         path: '/login',
        //         query: {redirect: to.fullPath}  // 将跳转的路由path作为参数，登录成功后跳转到该路由
        //     })
        // }
        if(store.state.isLogin){
            next()
        }else{
            next('/login');
        }
        
    }
    else {
        next();
    }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
